﻿#include "mycomponent.h"
#include "ui_mycomponent.h"

MyComponent::MyComponent(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MyComponent)
{
    ui->setupUi(this);
}

MyComponent::~MyComponent()
{
    delete ui;
}

QString MyComponent::getText()
{
    return ui->le_text->text();
}

void MyComponent::setText(QString str)
{
    ui->le_text->setText(str);
}

QString MyComponent::getSelectedText()
{
    return ui->cb_selectBox->currentText();
}

void MyComponent::setSelectedText(QString str)
{
    ui->cb_selectBox->setCurrentText(str);
}

int MyComponent::getSelectedIndex()
{
    return ui->cb_selectBox->currentIndex();
}

void MyComponent::setSelectedIndex(int index)
{
    ui->cb_selectBox->setCurrentIndex(index);
}

void MyComponent::on_combox_selected()
{
    ui->le_text->setText(ui->cb_selectBox->currentText());
    emit selectBoxSelectedSig(ui->cb_selectBox->currentIndex(), ui->cb_selectBox->currentText());
}
